TABLE.EXTERNAL_RECORD_CONTENT_GET Function
Syntax
Arguments
- tablename
The table that contains the records you wish to retrieve.
- content_expression
An expression that processes the records that are selected and returns a character value.
- order
Optional. Default = "" (record number order). A character order expression that sorts selected records.
- filter
Optional. Default = All records. A character filter expression that evaluates to a logical value. Selects records from the table.
Description
Retrieve external tables records in a cr-lf separated list.
Discussion
The TABLE.EXTERNAL_RECORD_CONTENT_GET() method creates a CR-LF delimited string of values from a table. The values in the string are obtained by evaluating the Content_Expn for each record in the table that satisfies the Filter_Expn. The order of the values in the string is specified by the Order_Expn. This method is very useful if you have to populate an array with values from a table. Note : When working with a table that is already open, <TBL>.RECORD_CONTENT_GET() is faster.
Example
The following script populates an array with the first and last names of people in Massachusetts from the Customer table.
dim names100 as C list = table.external_record_content_GET("customer", "alltrim(firstname) + ' ' + lastname", "lastname", "state = 'ma'") names.initialize(list)
This function returns nothing because the Content_Expn (in this case the 'date' field) returns a Date type.
? table.external_record_content_get("invoice_header","date","","") = ""
Here we use the dtoc() function to transform the content_expn to a character type.
? table.external_record_content_get("invoice_header", "dtoc(Date)", "", "") = 01/10/2002 01/10/2002 01/11/2002 01/11/2002 01/12/2002
In this example, its hard to see what i have done, but I have prefixed the content expression with a NULL string ( '' -- two single quotes). this makes the content_expression return a character value.
? table.external_record_content_get("invoice_header", "'' + date", "", "") = 01/10/2002 01/10/2002 01/11/2002 01/11/2002 01/12/2002 01/12/2002
This technique of prefixing a value with a NULL string to transform it to a character value is new in V5 (i.e. could not be done in v4.5). it is very useful.
? '"" + date()' "01/24/2004"
See Also